package cn.tedu.oop;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Test1_Exception {
    public static void main(String[] args) {
        method();
        method2();
        try {
            method3();
        }catch (Exception e){
            System.out.println("运算错误！");
        }
    }
    public static void method(){
        int a = new Scanner(System.in).nextInt();
        int b = new Scanner(System.in).nextInt();
        System.out.println(a/b);
    }
    public static void method2(){
        try {
            int a = new Scanner(System.in).nextInt();
            int b = new Scanner(System.in).nextInt();
            System.out.println(a/b);
        }catch (InputMismatchException a){
            System.out.println("请输入两次整数！");
        }catch (ArithmeticException a){
            System.out.println("第二次输入的整数不能为0！");
        }catch (Exception a){
            System.out.println("请输入正确的数据！！");
        }
    }
    public static void method3() throws Exception {
        int a = new Scanner(System.in).nextInt();
        int b = new Scanner(System.in).nextInt();
        System.out.println(a/b);
    }
}